
#region Imports

using System;
using System.Messaging;
using System.Text;
using System.Xml;

#endregion

namespace Justa.Messaging
{
    /// <summary>
    /// 
    /// </summary>
    /// 
    /// <param name="messageEventArgs"></param>
    /// 
    public delegate void MessageEventHandler(object sender, MessageEventArgs messageEventArgs);

    /// <summary>
    /// 
    /// </summary>
    /// 
    public interface IMessageGateway
    {
        /// <summary>
        /// 
        /// </summary>
        /// 
        event MessageEventHandler OnMessageRecieved;

        /// <summary>
        /// 
        /// </summary>
        /// 
        /// <param name="message"></param>
        /// 
        void Send(string message);

        /// <summary>
        /// 
        /// </summary>
        /// 
        /// <param name="message"></param>
        /// 
        void Send(XmlDocument message);

        /// <summary>
        /// 
        /// </summary>
        /// 
        /// <param name="destination"></param>
        /// <param name="message"></param>
        /// 
        void Send(string destination, string message);

        /// <summary>
        /// 
        /// </summary>
        /// 
        /// <param name="destination"></param>
        /// <param name="message"></param>
        /// 
        void Send(string destination, XmlDocument message);

        /// <summary>
        /// 
        /// </summary>
        /// 
        /// <param name="destination"></param>
        /// <param name="message"></param>
        /// 
        void Send(string destination, Message message);

        /// <summary>
        /// 
        /// </summary>
        /// 
        /// <param name="responseDestination"></param>
        /// <param name="message"></param>
        /// 
        /// <returns></returns>
        /// 
        string Request(string responseDestination, string message);

        /// <summary>
        /// 
        /// </summary>
        /// 
        /// <param name="responseDestination"></param>
        /// <param name="message"></param>
        /// 
        /// <returns></returns>
        /// 
        string Request(string responseDestination, XmlDocument message);

        /// <summary>
        /// 
        /// </summary>
        /// 
        /// <param name="responseDestination"></param>
        /// <param name="message"></param>
        /// <param name="timeout"></param>
        /// 
        /// <returns></returns>
        /// 
        string Request(string responseDestination, string message, int timeout);

        /// <summary>
        /// 
        /// </summary>
        /// 
        /// <param name="responseDestination"></param>
        /// <param name="message"></param>
        /// <param name="timeout"></param>
        /// 
        /// <returns></returns>
        /// 
        string Request(string responseDestination, XmlDocument message, int timeout);

        /// <summary>
        /// 
        /// </summary>
        /// 
        /// <param name="destination"></param>
        /// <param name="responseDestination"></param>
        /// <param name="message"></param>
        /// <param name="timeout"></param>
        /// 
        /// <returns></returns>
        /// 
        string Request(string destination, string responseDestination, string message, int timeout);

        /// <summary>
        /// 
        /// </summary>
        /// 
        /// <param name="destination"></param>
        /// <param name="responseDestination"></param>
        /// <param name="message"></param>
        /// <param name="timeout"></param>
        /// 
        /// <returns></returns>
        /// 
        string Request(string destination, string responseDestination, XmlDocument message, int timeout);

        /// <summary>
        /// 
        /// </summary>
        /// 
        /// <param name="messageEventHandler"></param>
        /// 
        void Receive(string destination, MessageEventHandler messageEventHandler);

        /// <summary>
        /// 
        /// </summary>
        /// 
        /// <param name="destination"></param>
        /// 
        void StopReceiving(string destination);
    }
}